package  {
/**
 * @author maxim.zaks@gmail.com
 */
public const InlineXMLSpec : Object = 
	{
		description : "Spezifikation von Inline XML und E4X",
		expectations:[
		
			{
				description: "Inline XML is von Type XML",
				behaviour:function():Boolean{
					var xml : XML = <root/>;
					return xml is XML;
				},
				shouldEqual:true		
			},
			{
				description: "Greife auf eine XML mit '.' operator zu. " +
				"Der return Wert sollte XMLList sein",
				behaviour:function():Boolean{
					var xml : XML = <root><a/></root>;
					return xml.a is XMLList;
				},
				shouldEqual:true
			},
			{
				description:"Type eines attributes soll XMLList sein",
				behaviour:function():Boolean{
					var xml : XML = <root max="20"/>;
					return xml.@max is XMLList;
				},
				shouldEqual:true
			},
			{
				description:"var xml = <root><a/><b>Hallo</b></root>. " +
				"xml.b soll <b>Hallo</b> sein",
				behaviour:function():*{
					var xml : XML = <root><a/><b>Hallo</b></root>;
					return xml.b;
				},
				shouldEqual:<b>Hallo</b>
			},
			{
				description:"var xml = <root/> " +
				"xml.a soll nicht null sein",
				behaviour:function():*{
					var xml : XML = <root/>;
					return xml.a;
				},
				shouldNotEqual:null
			},
			{
				description:"var xml = <root/> " +
				"xml[0] soll ein neues XML object sein",
				behaviour:function():*{
					var xml : XML = <root/>;
					return xml[0];
				},
				shouldEqual:new XML()
			},
			{
				description:"var xml = <root/> " +
				"xml.a soll new XMLList() sein",
				behaviour:function():*{
					var xml : XML = <root/>;
					return xml.a;
				},
				shouldEqual:new XMLList()
			},
			{
				description:"var xml = <root/> " +
				"xml..a soll new XMLList() sein",
				behaviour:function():*{
					var xml : XML = <root/>;
					return xml..a;
				},
				shouldEqual:new XMLList()
			},
			{
				description:"var xml = <root><a/></root> " +
				"xml.a[0] soll von typ XML sein",
				behaviour:function():*{
					var xml : XML = <root><a/></root>;
					return xml.a[0] is XML;
				},
				shouldEqual:true
			},
			{
				description:"var xml = <root></root> " +
				"xml.a[0] soll undefined sein",
				behaviour:function():*{
					var xml : XML = <root></root>;
					var node : * = xml.a[0];
					return node;
				},
				shouldEqual:undefined
			},
			{
				description:"var xml = <root/> " +
				"xml.go() soll einen TypeError produzieren",
				behaviour:function():*{
					var xml : XML = <root/>;
					return xml.go();
				},
				shouldThrow:TypeError
			},
			{
				description:"<root><a/><b>Hallo</b></root>. " +
				"number of root children should be 2",
				behaviour:function():*{
					var xml : XML = <root><a/><b>Hallo</b></root>;
					return xml.children().length();
				},
				shouldEqual:2
			}
		]
		
	};
}
